package com.soul.common.feign;

import com.soul.common.bean.vo.DictionaryVo;
import com.soul.common.msg.ApiResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author Shiws
 * @version 1.0
 * @date 2023/11/20 17:28
 */
@FeignClient(contextId = "CommDictService", value = "soul-sys")
public interface CommDictService {
    @PostMapping("dict/query/dict/types")
    ApiResult<List<DictionaryVo>> queryDictListByTypes_(@RequestBody Collection<String> types);


    default List<DictionaryVo> queryDictListByTypes( Collection<String> types){
        ApiResult<List<DictionaryVo>> apiResult = this.queryDictListByTypes_(types);
        if (apiResult.getStatus() == 200){
            return apiResult.getData();
        }
        return new ArrayList<>();
    }
}
